﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.CMS263.Util;
using Com.CMS263.PO;
using Com.CMS263.BLL;
using System.IO;
namespace Com.CMS263.Web.manage.VoteManage
{
    public partial class vote_add : System.Web.UI.Page
    {
        VoteTopicBLL pbll = new VoteTopicBLL();
        public int sort = 1;

        protected void Page_Load(object sender, EventArgs e)
        {

            sort = pbll.GetMaxId();
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string title = StringUtil.checkStr(Request["txtTitle"]);
           
            string sortid = StringUtil.checkStr(Request["txtSortId"]);
            
            if (string.IsNullOrEmpty(title))
            {
                StringUtil.Alert("名称不能为空", "-1");
            }

            VoteTopic prod = new VoteTopic();
            prod.AddDate = DateTime.Now;
            prod.SortId = Convert.ToInt32(sortid);
            prod.Title = title;
            prod.ClickCount = 0;
            prod.ListId = 0;
            prod.VoteType = Convert.ToInt32(Request["selType"]);
            pbll.entity = prod;
            if (pbll.Add())
            {
                StringUtil.Alert("添加成功", "vote_list.aspx");
            }
            else
            {
                StringUtil.Alert("添加失败", "-1");
            }


        }

    }
}
